/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.tb_areas.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.service.TreeService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.tb_areas.entity.TbAreas;
import com.thinkgem.jeesite.modules.tb_areas.dao.TbAreasDao;

/**
 * 地区管理Service
 * @author ZhangYangZe
 * @version 2017-05-11
 */
@Service
@Transactional(readOnly = true)
public class TbAreasService extends TreeService<TbAreasDao, TbAreas> {

	public TbAreas get(String id) {
		return super.get(id);
	}
	
	public List<TbAreas> findList(TbAreas tbAreas) {
		if (StringUtils.isNotBlank(tbAreas.getParentIds())){
			tbAreas.setParentIds(","+tbAreas.getParentIds()+",");
		}
		return super.findList(tbAreas);
	}
	
	
	@Transactional(readOnly = false)
	public void save(TbAreas tbAreas) {
		super.save(tbAreas);
	}
	
	@Transactional(readOnly = false)
	public void delete(TbAreas tbAreas) {
		super.delete(tbAreas);
	}
	
	/**
	 * 查询下级城市（联动菜单用）
	 * @param parentId
	 * @return
	 */
	public List<TbAreas> findCityByParentId(String parentId){
		return dao.findCityByParentId(parentId);
	}
	
}